package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DzbqDzbqtype;
import com.ruoyi.system.service.IDzbqDzbqtypeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 标签类型Controller
 * 
 * @author ruoyi
 * @date 2025-01-31
 */
@RestController
@RequestMapping("/system/dzbqtype")
public class DzbqDzbqtypeController extends BaseController
{
    @Autowired
    private IDzbqDzbqtypeService dzbqDzbqtypeService;

    /**
     * 查询标签类型列表
     */
    @PreAuthorize("@ss.hasPermi('system:dzbqtype:list')")
    @GetMapping("/list")
    public TableDataInfo list(DzbqDzbqtype dzbqDzbqtype)
    {
        startPage();
        List<DzbqDzbqtype> list = dzbqDzbqtypeService.selectDzbqDzbqtypeList(dzbqDzbqtype);
        return getDataTable(list);
    }

    /**
     * 导出标签类型列表
     */
    @PreAuthorize("@ss.hasPermi('system:dzbqtype:export')")
    @Log(title = "标签类型", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DzbqDzbqtype dzbqDzbqtype)
    {
        List<DzbqDzbqtype> list = dzbqDzbqtypeService.selectDzbqDzbqtypeList(dzbqDzbqtype);
        ExcelUtil<DzbqDzbqtype> util = new ExcelUtil<DzbqDzbqtype>(DzbqDzbqtype.class);
        util.exportExcel(response, list, "标签类型数据");
    }

    /**
     * 获取标签类型详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dzbqtype:query')")
    @GetMapping(value = "/{dzbqTypeId}")
    public AjaxResult getInfo(@PathVariable("dzbqTypeId") Long dzbqTypeId)
    {
        return success(dzbqDzbqtypeService.selectDzbqDzbqtypeByDzbqTypeId(dzbqTypeId));
    }

    /**
     * 新增标签类型
     */
    @PreAuthorize("@ss.hasPermi('system:dzbqtype:add')")
    @Log(title = "标签类型", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DzbqDzbqtype dzbqDzbqtype)
    {
        return toAjax(dzbqDzbqtypeService.insertDzbqDzbqtype(dzbqDzbqtype));
    }

    /**
     * 修改标签类型
     */
    @PreAuthorize("@ss.hasPermi('system:dzbqtype:edit')")
    @Log(title = "标签类型", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DzbqDzbqtype dzbqDzbqtype)
    {
        return toAjax(dzbqDzbqtypeService.updateDzbqDzbqtype(dzbqDzbqtype));
    }

    /**
     * 删除标签类型
     */
    @PreAuthorize("@ss.hasPermi('system:dzbqtype:remove')")
    @Log(title = "标签类型", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dzbqTypeIds}")
    public AjaxResult remove(@PathVariable Long[] dzbqTypeIds)
    {
        return toAjax(dzbqDzbqtypeService.deleteDzbqDzbqtypeByDzbqTypeIds(dzbqTypeIds));
    }
}
